package com.monodaipoly.perfil;



import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;

public class ElegirAvatar extends ListActivity{

	BDglobal bdglobal;
	private ImageView mImagen;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.personaje);
        bdglobal=((BDglobal) getApplicationContext());
        cargarPersonajes();
	}
	
	
	public void cargarPersonajes(){
		Cursor c=bdglobal.getBaseDatosBD().fetchAllPersonajes();
		c.moveToFirst();
		while (!c.isLast()){
			mImagen=(ImageView) findViewById(R.id.imageView1);
			String nombreTux=c.getString(c.getColumnIndex(BaseDatosDbAdapter.KEY_AVATAR));
			int img = this.getResources().getIdentifier(nombreTux, "drawable","com.monodaipoly.perfil");
	        mImagen.setImageDrawable(this.getResources().getDrawable(img));
	        c.moveToNext();
		}
		mImagen=(ImageView) findViewById(R.id.imageView1);
		String nombreTux=c.getString(c.getColumnIndex(BaseDatosDbAdapter.KEY_AVATAR));
		int img = this.getResources().getIdentifier(nombreTux, "drawable","com.monodaipoly.perfil");
        mImagen.setImageDrawable(this.getResources().getDrawable(img));
       
	}

	
	
	
}
